package com.yisu.auction.api.core.mapper;

import com.yisu.auction.api.domain.request.prizePackage.PrizeDetailRequest;
import com.yisu.auction.api.domain.vo.activityPackageVos.LosingLotteryVo;
import com.yisu.auction.api.domain.vo.goodsInfoPackageVos.ClosingBidRecordVo;
import com.yisu.auction.api.domain.vo.goodsInfoPackageVos.OfferPriceVo;
import com.yisu.auction.ewf.entity.OfferPriceLog;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

public interface OfferPriceLogMapper {
    int deleteByPrimaryKey(Long id);

    int insert(OfferPriceLog record);

    int insertSelective(OfferPriceLog record);

    OfferPriceLog selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(OfferPriceLog record);

    int updateByPrimaryKey(OfferPriceLog record);

    /**
     * author: 赵杰
     * Business Description：通过会员memberId和prizeId 获取用户出价总额
     * @param prizeDetailRequest 含会员 ID   prizeId
     * @return
     */
    BigDecimal getUserOfferPriceByPrizeId(PrizeDetailRequest prizeDetailRequest);

    /**
     * author: 赵杰
     * Business Description：通过prizeId 获取出价总额
     * @param prizeId prizeId
     * @return
     */
    BigDecimal getOfferPriceByPrizeId(@Param("prizeId") long prizeId);


    /**
     * author: 赵杰
     * Business Description：通过prizeId获取此拍品出价流水
     * @param prizeDetailRequest 含prizeId
     * @return
     */
    List<OfferPriceVo> getOfferPriceLogListByPrizeId(PrizeDetailRequest prizeDetailRequest);

    /**
     * author: 赵杰
     * Business Description：通过prizeId 获取当前竞拍流水最大排序
     * @param prizeId prizeId
     * @return
     */
    int getMaxOfferPriceSortByPrizeId(@Param("prizeId") long prizeId);


    /**
     * author: 赵杰
     * Business Description：通过prizeId 将未出局的用户设置出局
     * @param prizeId prizeId
     * @return
     */
    int setOutByPrizeId(@Param("prizeId") long prizeId);


    /**
     * author: 赵杰
     * Business Description：通过prizeId 获取拍中的用户记录
     * @param prizeId prizeId
     * @return
     */
    OfferPriceLog getWinnerLogByPrizeId(@Param("prizeId") long prizeId);


    /**
     * author: 赵杰
     * Business Description：通过prizeId最后出价记录
     * @param prizeId
     * @return
     */
    ClosingBidRecordVo getClosingBidRecordByPrizeId(@Param("prizeId") long prizeId);

    /**
     * author: 赵杰
     * Business Description：通过prizeId获取未中奖用户列表及出价总计
     * @param prizeId
     * @return
     */
    List<LosingLotteryVo> getLosingLotteryByPrizeId(@Param("prizeId")long prizeId);


    /**
     * author: 赵杰
     * Business Description：通过ID，修改中奖状态
     * @param id
     * @return
     */
    int updateWinnerStatusById(Long id);


    /**
     * author: 赵杰
     * Business Description：通过prizeId获取出价列表，非分页
     * @param prizeId
     * @return
     */
    List<OfferPriceLog> getOfferPriceLogByPrizeId(@Param("prizeId") long prizeId);

    /**
     * 获取数据库时间-为所有倒计时服务
     * @return
     */
    Timestamp getDbDate();

}